package main;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.ScrollPaneConstants;
import javax.swing.border.Border;

public class InterfaceCalcular extends JPanel{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JTextArea historico, previewFormula;
	private JScrollPane scrollHistorico;
	private Border borderVisor;
	private JButton botaoOK, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18;

	private Modelo _modelo;
	
	
	public InterfaceCalcular(Modelo modelo) {
		
		_modelo = modelo;
		_modelo.setInterfaceCalcular(this);
		Dimension d = new Dimension(_modelo.getInterfacePrincipal().getSize());
		setSize(d);
		setPreferredSize(d);
		setMinimumSize(d);
		setMaximumSize(d);
		InicializeComponents();
		addComponents();
		
		
	}
	
	private void addComponents() {
		
		this.add(historico);
		historico.setSize(315, 70);
		historico.setPreferredSize(new Dimension(315, 70));
		historico.setMaximumSize(new Dimension(315, 70));
		historico.setMinimumSize(new Dimension(315, 70));
		
		this.add(previewFormula);
		
		previewFormula.setSize(300, 50);
		previewFormula.setPreferredSize(new Dimension(200, 50));
		previewFormula.setMaximumSize(new Dimension(200, 50));
		previewFormula.setMinimumSize(new Dimension(200, 50));
		
		this.add(botaoOK);
		
		botaoOK.setSize(52, 50);
		botaoOK.setPreferredSize(new Dimension(52, 50));
		botaoOK.setMaximumSize(new Dimension(52, 50));
		botaoOK.setMinimumSize(new Dimension(52, 50));
		

		Dimension d = new Dimension(150, 30);
		
		this.add(f1);
		f1.setSize(d);
		f1.setPreferredSize(d);
		f1.setMaximumSize(d);
		f1.setMinimumSize(d);
		
		this.add(f2);
		f2.setSize(d);
		f2.setPreferredSize(d);
		f2.setMaximumSize(d);
		f2.setMinimumSize(d);
		this.add(f3);
		f3.setSize(d);
		f3.setPreferredSize(d);
		f3.setMaximumSize(d);
		f3.setMinimumSize(d);
		
		this.add(f4);
		f4.setSize(d);
		f4.setPreferredSize(d);
		f4.setMaximumSize(d);
		f4.setMinimumSize(d);
		this.add(f5);
		f5.setSize(d);
		f5.setPreferredSize(d);
		f5.setMaximumSize(d);
		f5.setMinimumSize(d);
		this.add(f6);
		f6.setSize(d);
		f6.setPreferredSize(d);
		f6.setMaximumSize(d);
		f6.setMinimumSize(d);
		
		this.add(f7);
		f7.setSize(d);
		f7.setPreferredSize(d);
		f7.setMaximumSize(d);
		f7.setMinimumSize(d);
		this.add(f8);
		f8.setSize(d);
		f8.setPreferredSize(d);
		f8.setMaximumSize(d);
		f8.setMinimumSize(d);
		this.add(f9);
		f9.setSize(d);
		f9.setPreferredSize(d);
		f9.setMaximumSize(d);
		f9.setMinimumSize(d);

		this.add(f10);
		f10.setSize(d);
		f10.setPreferredSize(d);
		f10.setMaximumSize(d);
		f10.setMinimumSize(d);
		this.add(f11);
		f11.setSize(d);
		f11.setPreferredSize(d);
		f11.setMaximumSize(d);
		f11.setMinimumSize(d);
		this.add(f12);
		f12.setSize(d);
		f12.setPreferredSize(d);
		f12.setMaximumSize(d);
		f12.setMinimumSize(d);
		
		this.add(f13);
		f13.setSize(d);
		f13.setPreferredSize(d);
		f13.setMaximumSize(d);
		f13.setMinimumSize(d);
		this.add(f14);
		f14.setSize(d);
		f14.setPreferredSize(d);
		f14.setMaximumSize(d);
		f14.setMinimumSize(d);
		this.add(f15);
		f15.setSize(d);
		f15.setPreferredSize(d);
		f15.setMaximumSize(d);
		f15.setMinimumSize(d);

		this.add(f16);
		f16.setSize(d);
		f16.setPreferredSize(d);
		f16.setMaximumSize(d);
		f16.setMinimumSize(d);
		this.add(f17);
		f17.setSize(d);
		f17.setPreferredSize(d);
		f17.setMaximumSize(d);
		f17.setMinimumSize(d);
		this.add(f18);
		f18.setSize(d);
		f18.setPreferredSize(d);
		f18.setMaximumSize(d);
		f18.setMinimumSize(d);
		
	}
	
	private void InicializeComponents() {
		
		setLayout(new FlowLayout());
		
		borderVisor=BorderFactory.createLineBorder(Color.BLACK);
		
		historico=new JTextArea("Hist�rico...", 5, 42);
		historico.setEditable(false); //<-- nao aceita input
		historico.setBorder(borderVisor);
		
		scrollHistorico = new JScrollPane(historico);
		scrollHistorico.setBorder(borderVisor);
		scrollHistorico.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
		
		previewFormula=new JTextArea("Preview da Formula", 3, 36);
		previewFormula.setBorder(borderVisor);
		
		botaoOK=new JButton("OK");
		/*botaoOK.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				InterfacePrograma program=new InterfacePrograma(modelo);
				program.setVisible(true);
			}
		});*/
		f1=new JButton("123456789abcdef");
		f2=new JButton("F2");
		f3=new JButton("F3");
		f4=new JButton("123456789abcdef");
		f5=new JButton("F5");
		f6=new JButton("123456789abcdef");
		f7=new JButton("F7");
		f8=new JButton("123456789abcdef");
		f9=new JButton("F9");
		f10=new JButton("123456789abcdef");
		f11=new JButton("F11");
		f12=new JButton("123456789abcdef");
		f13=new JButton("F13");
		f14=new JButton("123456789abcdef");
		f15=new JButton("F15");
		f16=new JButton("123456789abcdef");
		f17=new JButton("F17");
		f18=new JButton("123456789abcdef");
		
	}

	
	
	
	
}
